package thread;

public class SyncDemo3 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->Boo.doSome());
        Thread t2 = new Thread(()->Boo.doSome());
        t1.start();
        t2.start();
    }
}
class Boo{
    public synchronized static void doSome(){
        try {
            Thread t = Thread.currentThread();
            System.out.println(t+"正在执行doSome方法");
            Thread.sleep(5000);
            System.out.println(t+"执行方法完毕");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
